package com.kaikai.vod.util;


import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.vod.model.v20170321.GetVideoInfoRequest;
import com.aliyuncs.vod.model.v20170321.GetVideoInfoResponse;
import com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthRequest;
import com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthResponse;

import java.io.UnsupportedEncodingException;

import static com.kaikai.vod.util.AliyunVodSDKUtils.initVodClient;
public class Test {
    public static void main(String[] args) throws ClientException, UnsupportedEncodingException {

        DefaultAcsClient client = initVodClient("LTAI5tFBfDWQq4Xh7fDXM8TE", "NK3NYxzKULYqKm17TEKVaaPKfSx00R");
        GetVideoPlayAuthRequest request = new GetVideoPlayAuthRequest();
        request.setVideoId("37edbdc1ff2045ba8e54ec222fe94278");
        GetVideoPlayAuthResponse response;
        try {
            response = client.getAcsResponse(request);
            //播放凭证
            System.out.print("PlayAuth = " + response.getPlayAuth() + "\n");
            //VideoMeta信息
            System.out.print("VideoMeta.Title = " + response.getVideoMeta().getTitle() + "\n");
            System.out.print("RequestId = " + response.getRequestId() + "\n");
            System.out.println("url = ");
        } catch (Exception e) {
            System.out.print("ErrorMessage = " + e.getLocalizedMessage());
        }

    }

}